/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SnpDbHndInterfaces;

import java.rmi.RemoteException;

/**
 * Interface providing connection to SnippetBase server and authentication functionality.
 * @author Łukasz 'byku' Guzik
 */
public interface DBConnectable extends java.rmi.Remote
{
    /**
     * Establishes connection with server and authenticates user.
     * @param login Login of user defined and enabled in database
     * @param pwdHash SHA1 hash calculated from user's password
     * @return If succeed returns true. Otherwise returns false
     * @throws RemoteException
     */
    String connectAndAuth(String login, String pwdHash) throws
	    RemoteException;

    /**
     * Method closing connection to DBMS
     * @throws RemoteException
     */
    void disconnect(String sessionID) throws RemoteException;

   /**
    * Getter for object managing users in database
    * @return Interface for managing users
    * @throws RemoteException
    */
    DBUsrHandling getUserHandler(String sessionID) throws RemoteException;

    /**
    * Getter for object managing categories in database
    * @return Interface for managing categories
    * @throws RemoteException
    */
    DBCatHandling getCatHandler(String sessionID) throws RemoteException;

     /**
    * Getter for object managing snippets in database
    * @return Interface for managing snippets
    * @throws RemoteException
    */
    DBSnpHandling getSnpHandler(String sessionID) throws RemoteException;
}
